#version 450

layout(location=0)      in vec3 a_Pos;
layout(location=2)      in vec2 a_Texcoord;
layout(location=3)      in vec4 a_ModelMat0;
layout(location=4)      in vec4 a_ModelMat1;
layout(location=5)      in vec4 a_ModelMat2;
layout(location=6)      in vec4 a_ModelMat3;

layout(set=0, binding=0, std140) uniform GlobalUbo{
    mat4 projMat;
    mat4 viewMat;
} globalUbo;

out gl_PerVertex{
    vec4 gl_Position;
};

layout(location=2) out vec2 v_Texcoord;

void main(){
    mat4 modelMat = mat4(
        a_ModelMat0,
        a_ModelMat1,
        a_ModelMat2,
        a_ModelMat3
    );

    gl_Position = globalUbo.projMat * globalUbo.viewMat * modelMat * vec4(a_Pos.x, a_Pos.y, a_Pos.z, 1.f);
    v_Texcoord = a_Texcoord;
}